package com.starfleet.galleryofdingao

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat.startActivity
import com.starfleet.galleryofdingao.ui.theme.GalleryOfDingsExTheme


class exActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            GalleryOfDingsExTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    val intent = Intent(this,GalleryActivity::class.java)

                    GalleryAgentPage(intent,this)
                }
            }
        }
    }
}

@Composable
fun GalleryAgentPage(intent: Intent, mContext: exActivity){

        Image(
            painter = painterResource(id = R.drawable.ocean_background),
            contentDescription = stringResource(R.string.ocean_description),
            contentScale = ContentScale.Crop
        )

        Column(
            verticalArrangement = Arrangement.Center
        ) {
        Text(
            text = stringResource(R.string.Invitation_to_Gallery),
            color = Color.Green,
            modifier = Modifier
                .align(alignment = Alignment.CenterHorizontally)
                .padding(horizontal = 20.dp)
        )
            Text(
                text = stringResource(R.string.technical_problem_announcement),
                color = Color.Cyan,
                modifier = Modifier
                    .align(alignment = Alignment.CenterHorizontally)
                    .padding(horizontal = 20.dp)
            )
        Button(
            onClick = { startActivity(mContext,intent,null) },
            modifier = Modifier.align(Alignment.CenterHorizontally)
            )
        {
            Text(text = stringResource(R.string.transport_to_the_gallery))
            }
        }
}

/*
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    GalleryOfDingsExTheme {
        Greeting("Android")
    }
}

 */